﻿cmake_minimum_required(VERSION 3.5)

project(InteUtils VERSION 0.1 LANGUAGES CXX)

set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(ProgramName InteUtils)

set(SourceFiles
	InteUtils_global.h
	IUMacros.h
	IUTcpSocket.cpp
	IUTcpSocket.h
	IUTypes.cpp
	IUTypes.h
	IUString.cpp
	IUString.h
	IURect.cpp
	IURect.h
	IUSize.cpp
	IUSize.h
	IUImage.cpp
	IUImage.h
	IUCompress.cpp
	IUCompress.h
	IUColor.cpp
	IUColor.h
	IUByteArray.cpp
	IUByteArray.h
	IUPoint.cpp
	IUPoint.h
	IUVector.cpp
	IUVector.h
)

option(BUILD_INTE_UTIL_SHARED "是否将集成工具编译为动态库" ON)

include_directories(
	${Third_UV}/include
	${Third_STB_IMAGE}
	${Third_ZLIB}/include
)

link_directories(
${Third_UV}/lib
${Third_ZLIB}/lib
)

if(${BUILD_INTE_UTIL_SHARED})
add_library(${ProgramName} SHARED
  ${SourceFiles}
)
else()
add_library(${ProgramName}
  ${SourceFiles}
)
endif()



if(WIN32)
    set(PlatFormLib
	PRIVATE ws2_32
	PRIVATE psapi
	PRIVATE user32
	PRIVATE advapi32
	PRIVATE iphlpapi
	PRIVATE userenv
	PRIVATE dbghelp
	PRIVATE ole32
	PRIVATE uuid
	PRIVATE kernel32
	PRIVATE gdi32
	PRIVATE winspool
	PRIVATE shell32
	PRIVATE oleaut32
	PRIVATE comdlg32)
endif()

if(UNIX)
	set(PlatFormLib 
	-pthread)
endif()

target_link_libraries(${ProgramName} 
${PlatFormLib} 
PRIVATE libuv
PRIVATE zlibstatic)
set_target_properties(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
target_compile_definitions(${PROJECT_NAME} PRIVATE InteUtils_LIBRARY)
